package net.portly.cst;

import java.io.Serializable;

/**
 * Models the asset type and its id.Optionally fw_uid can be specified
 * 
 * @author cs76
 *
 */
public class AssetIdType implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String assettype;
	private String id;
	private String fw_uid;

	public AssetIdType(String assettype, String id, String fw_uid) {
		super();
		this.assettype = assettype;
		this.id = id;
		this.fw_uid = fw_uid;
	}

	public AssetIdType(String assettype, String id) {
		this(assettype, id, null);
	}

	public AssetIdType(String pair) {
		if (pair != null) {
			String split[]= pair.split(":");
			if (split!= null && split.length == 2) {
				this.assettype = split[0];
				this.id = split[1];
			}
		}
	}

	public String getAssetType() {
		return assettype;
	}

	public String getId() {
		return id;
	}

	public String getFw_uid() {
		return fw_uid;
	}

	public void setFw_uid(String fw_uid) {
		this.fw_uid = fw_uid;
	}
	
	public String toString() {
		return "[ id: " + id + " type: " + assettype + (fw_uid != null ? " fw_uid: " + fw_uid : "") + " ]";
	}
}
